


public class Date {

    public int year;
    public int month;
    public int day;

    //public void setDate(int y,int m,int d){
    public void setDate(int year,int month,int day){
        this.year=year;
        this.month=month;
        this.day=day;
    }

    public void printDate(){
        System.out.println(year+"年"+month+"月"+day+"日");
    }

    public static void main(String[] args) {
        Date date=new Date();//实例化对象
        date.setDate(2024,2,26);
        date.printDate();
        System.out.println("==============");
        Date date2=new Date();//实例化对象
        date2.setDate(2024,2,15);
        date2.printDate();
    }

}
